package org.example.common.validate;

import org.example.common.validate.annotation.Sex;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author lsliang
 */
public class SexValidator implements ConstraintValidator<Sex, String> {

    @Override
    public void initialize(Sex constraintAnnotation) {

    }

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {

        return "man".equals(s) || "woman".equals(s);
    }
}
